package com.keelau.repository;

import com.keelau.idao.AliCatalogDao;
import com.keelau.idao.AliCatalogTreeDao;
import com.keelau.idao.AliProductDao;
import com.keelau.idao.model.AliCatalog;
import com.keelau.idao.model.AliCatalogExample;
import com.keelau.idao.model.AliProduct;
import com.keelau.idao.model.AliProductExample;
import com.keelau.ui.view.AliCatalogTree;
import com.keelau.ui.view.AliProductView;
import org.apache.ibatis.session.SqlSessionFactory;

import javax.inject.Inject;
import javax.inject.Named;
import java.util.List;

@Named
public class DataManager {

    @Inject
    SqlSessionFactory sqlSessionFactory;


    @Inject
    AliCatalogDao aliCatalogDao;

    @Inject
    AliCatalogTreeDao aliCatalogTreeDao;

    @Inject
    AliProductDao aliProductDao;


    public int insertCatalog(AliCatalog aliCatalog){
        return aliCatalogDao.insert(aliCatalog);
    }

    public int insertAliProduct(AliProduct aliProduct){
        return  aliProductDao.insert(aliProduct);
    }

    public List<AliProduct> selectAliProdutList(AliProductExample aliProductExample){return  aliProductDao.selectByExample(aliProductExample);}

    public List<AliCatalog> getCataLogList(AliCatalogExample aliCatalogExample){
        List<AliCatalog> list = null;
        list = aliCatalogDao.selectByExample(aliCatalogExample);
        return  list;
    }

    public List<AliCatalogTree> getParentCatalogList(){
        List<AliCatalogTree> list =  aliCatalogTreeDao.getParentCatalogList();
        return  list;
    }


}
